﻿<UserControl x:Class="UT3Bots.Visualizer.Controls.UTUIScoreControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
	xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    Width="Auto" Height="Auto">
	<Grid x:Name="LayoutRoot" Background="#606060">
		<StackPanel Orientation="Horizontal" Name="stackScores">
			<TextBlock Text="#1 " Foreground="White" />
			<TextBlock Name="txtScoreName" Text="" Width="200" Foreground="White" />
			<TextBlock Name="txtScorePoints" Text="" Width="100" Foreground="White" />
		</StackPanel>
		<Grid Name="gridHolder"  Margin="-20,15,-20,-415" Height="400" Width="350" Visibility="Collapsed">
			<Rectangle Margin="0,0,0,0" Stroke="#FF969696" Fill="#606060" RadiusY="7" RadiusX="7" StrokeThickness="2"/>
			
			<data:DataGrid Name="gridScores" Margin="4,4,4,4"
						   FontFamily="Verdana" 
						   IsReadOnly="True" 
						   AutoGenerateColumns="False" 
						   CanUserResizeColumns="False" 
						   CanUserReorderColumns="False"
						   GridLinesVisibility="Horizontal"
						   CanUserSortColumns="False"
						   RowDetailsVisibilityMode="VisibleWhenSelected"
						   AreRowDetailsFrozen="False"
						   HeadersVisibility="Column" 
						   AlternatingRowBackground="LemonChiffon"
						   HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" 
						   Style="{StaticResource UT3DataGridStyle2}">
				
				<data:DataGrid.Columns>
					<data:DataGridTemplateColumn Header="#" Width="10" >
						<data:DataGridTemplateColumn.CellTemplate>
							<DataTemplate>
								<Grid Height="50">
									<TextBlock Name="txtRowIndex" Text="{Binding Position}" FontWeight="Bold" VerticalAlignment="Center" TextAlignment="Center"/>
								</Grid>
							</DataTemplate>
						</data:DataGridTemplateColumn.CellTemplate>
					</data:DataGridTemplateColumn>
					<data:DataGridTemplateColumn Header="Name" Width="150" >
						<data:DataGridTemplateColumn.CellTemplate>
							<DataTemplate>
								<TextBlock Text="{Binding Name}" Margin="3,0,0,0" TextWrapping="Wrap" VerticalAlignment="Center"/>
							</DataTemplate>
						</data:DataGridTemplateColumn.CellTemplate>
					</data:DataGridTemplateColumn>
					<data:DataGridTemplateColumn Header="Score" SortMemberPath="Score" Width="50" >
						<data:DataGridTemplateColumn.CellTemplate>
							<DataTemplate>
								<TextBlock Text="{Binding Score}" TextAlignment="Center"  TextWrapping="Wrap" VerticalAlignment="Center"/>
							</DataTemplate>
						</data:DataGridTemplateColumn.CellTemplate>
					</data:DataGridTemplateColumn>
				</data:DataGrid.Columns>

				<data:DataGrid.RowDetailsTemplate>
					<DataTemplate>
						<StackPanel Orientation="Horizontal">
							<StackPanel Margin="5 5 5 5" Height="80" >
								<StackPanel Orientation="Horizontal" Width="150">
									<TextBlock Text="Id: " Margin="1,0,0,0" TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.Id}" TextWrapping="Wrap" FontSize="10" Width="120"/> 
								</StackPanel>	
								
								<Grid Height="Auto" Width="100">
									<Canvas Width="40" Height="55">
										<Canvas Canvas.Left="20" Canvas.Top="25">
											<Canvas.RenderTransform>
												<RotateTransform Angle="-135" CenterX="0" CenterY="0"/>
											</Canvas.RenderTransform>
											<Canvas Canvas.Left="-10" Canvas.Top="-10" Width="20" Height="20">
												<Ellipse Name="botCircle" Fill="{Binding Bot.Color, Converter={StaticResource BC}}" Height="20" Width="20" StrokeThickness="1" Stroke="#FF000000" HorizontalAlignment="Stretch" />
												<Rectangle Name="botPointer" Canvas.Left="8" Canvas.Top="9" Width="4" Height="20" Fill="Gray" StrokeThickness="1" Stroke="Black" />
												<Canvas Height="20" Width="20" Name="botDamage" Visibility="Collapsed">
													<Path Height="20" Width="20" Canvas.Left="0.125" Canvas.Top="0.125" Stretch="Fill" Stroke="#FFFF0000" StrokeThickness="1" Data="M0.125,0.125 L19.125,19.125"/>
													<Path Height="20" Width="20" Canvas.Left="0.125" Stretch="Fill" Stroke="#FFFF0000" StrokeThickness="1" Data="M19.625,0.375 L0.625,19.375"/>
												</Canvas>
											</Canvas>
										</Canvas>
										<Grid Width="150" Height="20" Canvas.Left="-55" Canvas.Top="35">
											<TextBlock Text="{Binding Name}" FontFamily="Verdana" TextAlignment="Center" Foreground="Black" FontSize="10" />
										</Grid>
									</Canvas>
								</Grid>
								
								<StackPanel Orientation="Horizontal">
									<TextBlock Text="Loc: " TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.Location}" TextWrapping="Wrap" FontSize="10" Width="130"/> 
								</StackPanel>
							</StackPanel>
							<StackPanel Margin="5 5 5 5" Height="80" >
								<StackPanel Orientation="Horizontal">
									<TextBlock Text="Bot Mesh: " TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.Mesh}" TextWrapping="Wrap" FontSize="10" Width="50"/> 
								</StackPanel>
								<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
									<TextBlock Text="Health: " TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.Health}" TextWrapping="Wrap" FontSize="10" Width="50"/> 
								</StackPanel>
								<StackPanel Orientation="Horizontal">
									<TextBlock Text="Armor: " TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.ArmorStrength}" TextWrapping="Wrap" FontSize="10" Width="50"/> 
								</StackPanel>
								<StackPanel Orientation="Horizontal">
									<TextBlock Text="Weapon: " TextWrapping="Wrap" FontSize="10" /> 
									<TextBlock Text="{Binding Bot.Weapon}" TextWrapping="Wrap" FontSize="10" Width="100"/> 
								</StackPanel>
							</StackPanel>
						</StackPanel>
					</DataTemplate>
				</data:DataGrid.RowDetailsTemplate>
			</data:DataGrid>
		</Grid>

		<Button Width="20" Height="20" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="Button_Click"></Button>
    </Grid>
</UserControl>
